/*
 *
 *  MongoServiceMediator.java
 *
 *  Created by CodeRobot on 2014-10-28
 *  Copyright (c) 2014年 com.saike.chexiang All rights reserved.
 *
 */

package com.techwells.learningkites.networkservice;

import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.R.integer;
import android.app.DownloadManager.Request;
import android.content.Context;
import android.os.Environment;
import android.util.Log;

import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.techwells.learningkites.networkaccess.KitesRequestUrl;
import com.techwells.learningkites.networkservice.model.Avatar;
import com.techwells.learningkites.networkservice.model.Comment;
import com.techwells.learningkites.networkservice.model.Course;
import com.techwells.learningkites.networkservice.model.Favorite;
import com.techwells.learningkites.networkservice.model.FavoriteWord;
import com.techwells.learningkites.networkservice.model.Lesson;
import com.techwells.learningkites.networkservice.model.LessonVideo;
import com.techwells.learningkites.networkservice.model.Segment;
import com.techwells.learningkites.networkservice.model.Test;
import com.techwells.learningkites.networkservice.model.UserProfile;
import com.techwells.learningkites.networkservice.model.VideoAdditional;
import com.techwells.learningkites.networkservice.model.VideoCategory;
import com.techwells.learningkites.networkservice.model.CategoryVideo;
import com.techwells.learningkites.networkservice.model.CourseCategory;
import com.techwells.learningkites.networkservice.model.Items;
import com.techwells.learningkites.networkservice.model.Page;
import com.techwells.learningkites.networkservice.model.ReturnCode;
import com.techwells.learningkites.networkservice.model.Rss;
import com.techwells.learningkites.networkservice.model.Serial;
import com.techwells.learningkites.networkservice.model.Sentences;
import com.techwells.learningkites.networkservice.model.User;
import com.techwells.learningkites.networkservice.model.Video;
import com.techwells.learningkites.networkservice.model.VideoDetail;
import com.techwells.learningkites.networkservice.model.Word;
import com.techwells.taco.net.HttpConnectionUtils;
import com.techwells.taco.net.HttpHandler;
import com.techwells.taco.networkaccessor.NetworkAccess;
import com.techwells.taco.networkaccessor.NetworkResponse;
import com.techwells.taco.networkaccessor.RequestMethod;
import com.techwells.taco.networkservice.Field_Method_Parameter_Annotation;
import com.techwells.taco.networkservice.ServiceMediator;
import com.techwells.taco.networkservice.ServiceResponse;
import com.techwells.taco.networkservice.ServiceUtils;
import com.techwells.taco.parser.JsonHandler;
import com.techwells.taco.utils.Base64;
import com.techwells.taco.utils.Base64Coder;
import com.techwells.taco.utils.CommonUtil;
import com.techwells.taco.utils.FileUtil;


public class KitesServiceMediator extends ServiceMediator {
	
    //4.用户账号
	public final static String SERVICE_DO_LOGIN = "doLogin"; //登录
	public final static String SERVICE_DO_REGISTER = "doRegister"; //注册
	public final static String SERVICE_GET_EXISTS = "getExists"; //是否存在相同的loginId
	public final static String SERVICE_DO_LOGOUT = "doLogout"; //注销
	public final static String SERVICE_GET_PROFILE = "getProfile"; //用户Profile
	public final static String SERVICE_MODIFY_PROFILE = "modifyProfile"; //修改用户Profile
	public final static String SERVICE_MODIFY_PASSWORD = "modifyPassword"; //修改用户密码
	public final static String SERVICE_GET_AVATARS = "getAvatars"; //平台预置的用户头像
	public final static String SERVICE_DO_BASIC = "doBasic"; //修改用户基本信息
	public final static String SERVICE_DO_PASSWORD_LOST = "doPasswordLost"; //密码找回
	public final static String SERVICE_DO_PASSWORD_RESET = "doPasswordReset"; //密码重置
	public final static String SERVICE_DO_EMAIL_BIND  = "doEmailBind"; //绑定用户邮箱
	public final static String SERVICE_DO_EMAIL_UNBIND  = "doEmailUnbind"; //解绑用户邮箱
	
	
	
	 //5.学习进度
    //5.1用户学习的课件及课程
    public final static String SERVICE_GET_STUTIED_COURSES = "getStutiedCourses"; //获取已学习的课件列表
    public final static String SERVICE_GET_STUTIED_LESSONS = "getStutiedLessons"; //获取已学习的课程列表
    public final static String SERVICE_DO_LEARNING_LESSON = "doLearningLesson"; // 用户学习课程
    public final static String SERVICE_DELETE_COURSE = "deleteCourse"; //删除已学习的课件
    public final static String SERVICE_DELETE_ALL_COURSES = "deleteAllCourses"; //清空已学习的所有课程
    //5.2用户学习的视频
    public final static String SERVICE_GET_STUDIED_VIDEOS = "getStudiedVideos"; //获取已学习的视频列表
    public final static String SERVICE_GET_STUDIED_SEGMENTS = "getStudiedSegments"; //获取已学习的视频片段列表
    public final static String SERVICE_DO_LEARNING_VIDEO = "doLearningVideo"; //用户学习视频
    public final static String SERVICE_DELETE_STUDIED_VIDEO = "deleteStudiedVideo"; //删除已学习的视频
    public final static String SERVICE_DELETE_ALL_VIDEOS = "deleteAllVideos"; //清空已学习的视频
    //5.3用户收藏的视频
    public final static String SERVICE_GET_FAVORITE_VIDEOS = "getFavoriteVideos"; //获取用户收藏的所有视频(我的视频库)
    public final static String SERVICE_DO_FAVORITE_VIDEO = "doFavoriteVideo"; //收藏视频 
    public final static String SERVICE_DELETE_FAVORITE_VIDEO = "deleteFavoriteVideo"; //删除收藏的视频
    //5.4用户的生词本
    public final static String SERVICE_GET_ALL_WORDS = "getAllWords"; //获取所有生词
    public final static String SERVICE_ADD_WORDS = "addWords";  //添加生词 
    public final static String SERVICE_DELETE_WORDS = "deleteWords"; //删除生词
    //5.5用户的例句
    public final static String SERVICE_GET_SENTENCES = "getSentences"; //获取所有例句
    public final static String SERVICE_DO_VIDEO_SENTENCE = "doVideoSentence"; //添加例句
    public final static String SERVICE_DELETE_VIDEO_SENTENCE = "deleteVideoSentence"; //删除例句
	
	
	//6.课件
	
    public final static String SERVICE_GET_RECOMMEND_COURSES = "getRecommendCourses"; // 获取推荐的课件
    public final static String SERVICE_GET_COURSES_CATEGORIES = "getCoursesCategories"; //获取课件分类列表
    public final static String SERVICE_GET_COURSES_CATEGORIES_DETAIL ="getCoursesCategoriesDetail"; //获取课件分类详细信息
    public final static String SERVICE_GET_COURSES = "getCourses"; //获取课件列表
    public final static String SERVICE_GET_LESSONS = "getLessons"; //获取课程列表
    public final static String SERVICE_GET_DEFINED_COURSES = "getDefinedCourses"; //获取用户自定义的课件列表  
    public final static String SERVICE_GET_DEFINED_LESSONS = "getDefinedLessons"; //获取用户自定义的课件中的课程
    public final static String SERVICE_DO_DEFINED_COURSES = "doDefinedCourses"; //用户自定义课件
    public final static String SERVICE_ADD_DEFINED_COURSE_SERIAL = "addDefinedCourseSerial"; //添加用户自定义课件中的课程
    public final static String SERVICE_DELETE_DEFINED_COURSE_SERIAL = "deleteDefinedCourseSerial"; //取消用户自定义课件中的课程
    public final static String SERVICE_DELETE_DEFINED_COURSE = "deleteDefinedCourse"; //删除用户自定义课件
	
	
	//7.视频
	public final static String SERVICE_GET_VIDEOS_CATEGORIES  = "getVideoGategories"; //获取视频分类
	public final static String SERVICE_GET_CATEGORY_VIDEOS  = "getCategoryVideos"; //获取指定视频分类下的视频列表
	public final static String SERVICE_GET_VIDEO_DETAILS  = "getVideoDetails"; //获取视频详细数据
	public final static String SERVICE_GET_VIDEO_ADDITIONAL  = "getVideoAdditional"; //获取视频附加数据
	public final static String SERVICE_GET_VIDEO_SEGMENT  = "getVideoSegment"; //获取视频片段数据
	public final static String SERVICE_GET_VIDEO_SEGMENT_DETAILS  = "getVideoSegmentDetails"; //获取视频片段数据
	public final static String SERVICE_GET_VIDEO_SEGMENT_WORDS  = "getVideoSegmentWords"; //获取视频片段词汇
	public final static String SERVICE_GET_VIDEO_SEGMENT_SENTENCES  = "getVideoSegmentSentences"; //获取视频句子数据
	public final static String SERVICE_GET_VIDEO_SEGMENT_EXAMS  = "getVideoSegmentExams"; //获取视频句子数据
	public final static String SERVICE_GET_VIDEO_COMMENTS  = "getVideoComments"; //获取视频句子数据
	public final static String SERVICE_ADD_VIDEO_COMMENT  = "addVideoComment"; //获取视频句子数据
	public final static String SERVICE_DELETE_VIDEO_COMMENT  = "deleteVideoComment"; //获取视频句子数据
	
	
	//8.RSS
	public final static String SERVICE_GET_NEWEST_RSS  = "getNewestRss"; //最新的RSS
	public final static String SERVICE_GET_CATEGORIES_RSS  = "getCategoriesRss"; //获取RSS分类
	public final static String SERVICE_GET_CATEGORY_ITEM_RSS  = "getCategoriesItemRss"; //获取指定RSS分类下的文章列表
	public final static String SERVICE_GET_USER_RSS  = "getUserRss"; //用户订阅的RSS
	public final static String SERVICE_DO_SUBSCRIBE_RSS  = "doSubscribeRss"; //订阅RSS
	public final static String SERVICE_DELETE_USER_RSS  = "deleteUserRss"; //取消RSS订阅
	public final static String SERVICE_GET_FAVORITES_RSS  = "getFavoritesRss"; //用户收藏的RSS文章列表
	public final static String SERVICE_DO_FAVORITES_ITEM_RSS  = "doFavoritesItemRss"; //收藏RSS文章
	public final static String SERVICE_DELETE_FAVORITES_ITEM_RSS  = "deleteFavoritesItemRss"; //取消RSS的文章收藏
	
	
	//9.单词及例句
	public final static String SERVICE_GET_WORD_DETAILS  = "getWordDetails"; //获取单词的详细信息
	public final static String SERVICE_GET_WORD_SENTENCES  = "getWordSentences"; //获取单词的例句
	public final static String SERVICE_GET_SIMILAR_WORDS  = "getSimilarWords"; //获取相似单词
	
	
	//10.用户反馈
	public final static String SERVICE_DO_FEEDBACK  = "doFeedback"; //用户反馈
	
	
	//12.其他
	public final static String SERVICE_GET_CAPTCHA  = "getCaptcha"; //获取图片验证码
	public final static String SERVICE_DO_VERIFY_CAPTCHA  = "doVerifyCaptcha"; //验证图片验证码
	
	public final static String SERVICE_GET_VIDEO_STREAM  = "getVideoStream"; //获取视频播放流
	
	private static KitesServiceMediator mediator;

	private KitesServiceMediator() {
		super();
	}

	public static KitesServiceMediator sharedInstance() {
		if (mediator == null) {
			synchronized (KitesServiceMediator.class) {
				if (mediator == null) {
					mediator = new KitesServiceMediator();
				}
			}
		}
		return mediator;
	}

	public void setHttpHeader(Context context) {
	
	}
	
	
	
	
	//登录
    @Field_Method_Parameter_Annotation(args = {"username", "password", "t","sign"})
    public ServiceResponse<String> doLogin(String username, String password, String t, String sign) {
        // 默认初始化为失败信息
        ServiceResponse<String> response = new ServiceResponse<String>();
        response.setOperatCode(KitesRequestUrl.DO_LOGIN);

        String requestStr = "username="+username+"&password="+password+"&t="+t+"&sign="+sign;
        
        // 发起网络请求
        NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_LOGIN, requestStr ,RequestMethod.METHOD_POST);
        // 结果返回,错误码处理
        String responseStr = ServiceUtils.getRequestResult(response,netResponse);
        
        //无法正确返回responseStr，为null
//        responseStr = "{\"code\":\"200\"}";
//        Log.d("接收简森数据", ""+response.getReturnCode());
//        Log.d("接收简森数据", response.getReturnDesc());
        
//        if (response.getReturnCode() == HttpURLConnection.HTTP_OK ) {
//            // 返回成功 解析结果
//            JsonHandler.jsonToObject(responseStr, String.class, response);
//    		//httpHeader.userToken = response.getResponse().token;
//        }

        
        
        return response;
    }

	
    
    /**
	 *  OpenAPI 登陆接口
	 *
	 *  @param account       账号
	 *  @param password      密码
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"username","t","password"})
	public ServiceResponse<User> login(String username, String t, String password) {
		// 默认初始化为失败信息
		ServiceResponse<User> response = new ServiceResponse<User>();
		response.setOperatCode(KitesRequestUrl.DO_LOGIN);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("username", username);
        password = Base64.encode(password.getBytes());
        jsonObj.addProperty("password", password);
        long time = System.currentTimeMillis();
        jsonObj.addProperty("t", time);
        
        String signMd = generateSignParam(buildLoginParams(username, password, time));
        //String sign = "password="+password+"t="+t+"username="+username;
		//String signMd = CommonUtil.MD5Encrypt(sign);
		jsonObj.addProperty("sign", signMd);
        String requestStr = jsonObj.toString();
        Log.d("发送简森数据", requestStr);
        
        
        
		
		/*
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.LOGIN, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		Log.d("接收简森数据", ""+response.getReturnCode());
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, User.class, response);
			//httpHeader.userToken = response.getResponse().token;
		}
		*/
		return response;
	}
	
	
	private Map<String, String> buildLoginParams(String userName, String password, long t) {
        Map<String, String> params = new TreeMap<String, String>();
        params.put("username", "userName");
        params.put("password", Base64.encode(password.getBytes()));
        params.put("t", t + "");
        return params;
    }
    
	private String generateSignParam(Map<String, String> params) {
        StringBuffer sb = new StringBuffer();
        for(String k : params.keySet()) {
            String v = params.get(k);
            sb.append(k);
            sb.append("=");
            sb.append(v);
        }
        String signContent = sb.toString();
        String sign = CommonUtil.MD5Encrypt(signContent);
        return sign;
    }

	
	
    /**
	 *  注册接口
	 *
	 *  @param loginId       账号
	 *  @param password      密码	
	 *  @param verifyType
	 *  @param challenge
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"loginId","password","verifyType","challenge"})
	public ServiceResponse<String> doRegister(String loginId, String password,String verifyType,String challenge) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_REGISTER);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("loginId", loginId);
        jsonObj.addProperty("password", password);
        jsonObj.addProperty("verifyType", verifyType);
        jsonObj.addProperty("challenge", challenge);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.doHttpRequestJson(KitesRequestUrl.DO_REGISTER, requestStr,false,false,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		
		return response;
	}
	
	
    /**
	 *  是否存在相同的loginId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<String> getExists() {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.GET_EXISTS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_EXISTS, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
    /**
	 *  注销
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<String> doLogout() {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_LOGOUT);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_LOGOUT, requestStr ,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
    /**
	 *  用户Profile
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<UserProfile> getProfile() {
		// 默认初始化为失败信息
		ServiceResponse<UserProfile> response = new ServiceResponse<UserProfile>();
		response.setOperatCode(KitesRequestUrl.GET_PROFILE);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_PROFILE, requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, UserProfile.class, response);
		}
		return response;
	}
	
	
    /**
	 *  修改用户Profile
	 *  
	 *  @param code
	 *  @param value
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"code","value"})
	public ServiceResponse<String> modifyProfile(String code,String value) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.MODIFY_PROFILE);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("code", code);
        jsonObj.addProperty("value", value);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.MODIFY_PROFILE, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
    /**
	 *  修改用户Profile
	 *  
	 *  @param loginId
	 *  @param oldPass
	 *  @param newPass
	 *  @param confirmPass
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"loginId","oldPass","newPass","confirmPass"})
	public ServiceResponse<String> modifyPassword(String loginId,String oldPass,String newPass,String confirmPass) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.MODIFY_PASSWORD);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("loginId", loginId);
        jsonObj.addProperty("oldPass", oldPass);
        jsonObj.addProperty("newPass", newPass);
        jsonObj.addProperty("confirmPass", confirmPass);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.MODIFY_PASSWORD, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
    /**
	 *  平台预置的用户头像
	 *  
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<Avatar>> getAvatars() {
		// 默认初始化为失败信息
		ServiceResponse<List<Avatar>> response = new ServiceResponse<List<Avatar>>();
		response.setOperatCode(KitesRequestUrl.GET_AVATARS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_AVATARS, requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Avatar>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
    /**
	 *  修改用户基本信息
	 *  
	 *  @param uid
	 *  @param mobile
	 *  @param gender
	 *  @param name
	 *  @param nickName
	 *	@param address
	 *	@param email
	 *	@param avatar
	 *	
	 *	
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"uid","gender","name","nickName",
			"address","email","mobile","avatar"})
	public ServiceResponse<String> doBasic(int uid,int gender,String name,
			String nickName,String address,String email,String mobile,String avatar) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.doBasic(uid));

		
		String requestStr = "gender="+gender+"&name="+name+"&nickName="+nickName+"&address="+address
				+"&email="+email+"&avatar="+avatar+"&mobile="+mobile;
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.doBasic(uid), requestStr,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
    /**
	 *  密码找回
	 *  
	 *  @param loginId
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"loginId"})
	public ServiceResponse<String> doPasswordLost(String loginId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_PASSWORD_LOST);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("loginId", loginId);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_PASSWORD_LOST, requestStr ,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
    /**
	 *  密码重置
	 *  
	 *  @param code
	 *  @param Password
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"code","Password"})
	public ServiceResponse<String> doPasswordReset(String code,String Password) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_PASSWORD_RESET);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("code", code);
        jsonObj.addProperty("Password", Password);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_PASSWORD_RESET, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
    /**
	 *  绑定用户邮箱
	 *  
	 *  @param email
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"email"})
	public ServiceResponse<String> doEmailBind(String email) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_EMAIL_BIND);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("email", email);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_EMAIL_BIND, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
    /**
	 *  解绑用户邮箱
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<String> doEmailUnbind() {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_EMAIL_UNBIND);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_EMAIL_UNBIND, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	/**
	 *  获取已学习的课件列表
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<VideoDetail> getStutiedCourses() {
		// 默认初始化为失败信息
		ServiceResponse<VideoDetail> response = new ServiceResponse<VideoDetail>();
		response.setOperatCode(KitesRequestUrl.GET_STUTIED_COURSES);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_STUTIED_COURSES, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoDetail.class, response);
		}
		return response;
	}
	
	/**
	 *  获取已学习的课件列表
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId"})
	public ServiceResponse<VideoDetail> getStutiedLessons(int courseId) {
		// 默认初始化为失败信息
		ServiceResponse<VideoDetail> response = new ServiceResponse<VideoDetail>();
		response.setOperatCode(KitesRequestUrl.GET_STUTIED_LESSONS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_STUTIED_LESSONS, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoDetail.class, response);
		}
		return response;
	}
	
	/**
	 *  用户学习课程
	 *  
	 *  @param name
	 *  @param videoSerialIds
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId","lessonId"})
	public ServiceResponse<String> doLearningLesson(int courseId,int lessonId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = courseId+"/"+lessonId;
		response.setOperatCode(KitesRequestUrl.DO_LEARNING_LESSON);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_LEARNING_LESSON, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  删除已学习的课件
	 *  
	 *  @param courseId
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId"})
	public ServiceResponse<String> deleteCourse(int courseId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+courseId;
		response.setOperatCode(KitesRequestUrl.DELETE_COURSE);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_COURSE, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  清空已学习的所有课程
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<String> deleteAllCourses() {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DELETE_ALL_COURSES);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_ALL_COURSES, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  获取已学习的视频列表
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<Video>> getStudiedVideos() {
		// 默认初始化为失败信息
		ServiceResponse<List<Video>> response = new ServiceResponse<List<Video>>();
		response.setOperatCode(KitesRequestUrl.GET_STUDIED_VIDEOS);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_STUDIED_VIDEOS, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Video>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	
	/**
	 *  获取已学习的视频片段列表
	 *  
	 *  @param serialId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"serialId"})
	public ServiceResponse<List<Serial>> getStudiedSegments(int serialId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Serial>> response = new ServiceResponse<List<Serial>>();
//		KitesRequestUrl.dynamicUrl = ""+serialId;
		response.setOperatCode(KitesRequestUrl.GET_STUDIED_SEGMENTS);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_STUDIED_SEGMENTS, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Serial>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	
	/**
	 *  用户学习视频
	 *  
	 *  @param videoId
	 *  @param segmentId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId","segmentId"})
	public ServiceResponse<String> doLearningVideo(int videoId,int segmentId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = videoId + "/"+segmentId;
		response.setOperatCode(KitesRequestUrl.DO_LEARNING_VIDEO);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_LEARNING_VIDEO, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  删除已学习的视频
	 *  
	 *  @param videoId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId"})
	public ServiceResponse<String> deleteStudiedVideo(int videoId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+videoId;
		response.setOperatCode(KitesRequestUrl.DELETE_STUDIED_VIDEO);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_STUDIED_VIDEO, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  清空已学习的视频
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<String> deleteAllVideos() {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DELETE_ALL_VIDEOS);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_ALL_VIDEOS, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	
	/**
	 *  获取用户收藏的所有视频(我的视频库)
	 *  
	 *  @param l
	 *  @param n
	 *  @param o
	 *  @param s
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"l","n","o","s"})
	public ServiceResponse<Favorite> getFavoriteVideos(int l,int n,String o,String s) {
		// 默认初始化为失败信息
		ServiceResponse<Favorite> response = new ServiceResponse<Favorite>();
		response.setOperatCode(KitesRequestUrl.GET_FAVORITE_VIDEOS);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_FAVORITE_VIDEOS, requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, Favorite.class, response);
		}
		return response;
	}
	
	
	/**
	 *  收藏视频
	 *  
	 *  @param videoId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId"})
	public ServiceResponse<String> doFavoriteVideo(int videoId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+videoId;
		response.setOperatCode(KitesRequestUrl.doFavoriteVideo(videoId));
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.doFavoriteVideo(videoId), requestStr,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
	/**
	 *  删除收藏的视频
	 *  
	 *  @param videoId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId"})
	public ServiceResponse<String> deleteFavoriteVideo(int videoId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+videoId;
		response.setOperatCode(KitesRequestUrl.deleteFavoriteVideo(videoId));
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.deleteFavoriteVideo(videoId), requestStr, RequestMethod.METHOD_DELETE);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  获取所有生词
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<FavoriteWord>> getAllWords() {
		// 默认初始化为失败信息
		ServiceResponse<List<FavoriteWord>> response = new ServiceResponse<List<FavoriteWord>>();
		response.setOperatCode(KitesRequestUrl.GET_ALL_WORDS);
        JsonObject jsonObj = new JsonObject();
        
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_ALL_WORDS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<FavoriteWord>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  添加生词 
	 *  
	 *	@param word
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"word"})
	public ServiceResponse<String> addWords(String word) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_WORDS);
		JsonObject jsonObj = new JsonObject();
		jsonObj.addProperty("word", word);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.doHttpRequestJson(KitesRequestUrl.DO_WORDS, requestStr,false,false, RequestMethod.METHOD_POST);
        
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
	/**
	 *  删除生词
	 *  
	 *	@param uwid
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"uwid"})
	public ServiceResponse<String> deleteWords(int uwid) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.deleteWords(uwid));
		JsonObject jsonObj = new JsonObject();
//		jsonObj.addProperty("word", word);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.deleteWords(uwid), requestStr, RequestMethod.METHOD_DELETE);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
	/**
	 *  获取所有例句
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<Sentences>> getSentences() {
		// 默认初始化为失败信息
		ServiceResponse<List<Sentences>> response = new ServiceResponse<List<Sentences>>();
		response.setOperatCode(KitesRequestUrl.GET_SENTENCES);
		JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_SENTENCES, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Sentences>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  添加例句
	 *  
	 *	@param videoSentenceId
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoSentenceId"})
	public ServiceResponse<String> doVideoSentence(int videoSentenceId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+videoSentenceId;
		response.setOperatCode(KitesRequestUrl.doVideoSentence(videoSentenceId));
		JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.doVideoSentence(videoSentenceId), requestStr, RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
	/**
	 *  删除例句
	 *  
	 *	@param videoSentenceId
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoSentenceId"})
	public ServiceResponse<String> deleteVideoSentence(int videoSentenceId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+videoSentenceId;
		response.setOperatCode(KitesRequestUrl.deleteVideoSentence(videoSentenceId));
		JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.deleteVideoSentence(videoSentenceId), requestStr, RequestMethod.METHOD_DELETE);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	/**
	 *  获取推荐的课件
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<VideoDetail> getRecommendCourses() {
		// 默认初始化为失败信息
		ServiceResponse<VideoDetail> response = new ServiceResponse<VideoDetail>();
		response.setOperatCode(KitesRequestUrl.GET_RECOMMEND_COURSES);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_RECOMMEND_COURSES, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoDetail.class, response);
		}
		return response;
	}
	
	/**
	 *  获取课件分类列表
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<CourseCategory>> getCoursesCategories() {
		// 默认初始化为失败信息
		ServiceResponse<List<CourseCategory>> response = new ServiceResponse<List<CourseCategory>>();
		response.setOperatCode(KitesRequestUrl.GET_COURSES_CATEGORIES);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_COURSES_CATEGORIES, requestStr ,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<CourseCategory>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	/**
	 *  获取课件分类详细信息
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"categoryId"})
	public ServiceResponse<List<CourseCategory>> getCoursesCategoriesDetail(int categoryId) {
		// 默认初始化为失败信息
		ServiceResponse<List<CourseCategory>> response = new ServiceResponse<List<CourseCategory>>();
		KitesRequestUrl.dynamicUrl = ""+categoryId;
		response.setOperatCode(KitesRequestUrl.GET_COURSES_CATEGORIES_DETAIL);		
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_COURSES_CATEGORIES_DETAIL, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<CourseCategory>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	/**
	 *  获取课件列表
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseCategoryId"})
	public ServiceResponse<List<Course>> getCourses(int courseCategoryId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Course>> response = new ServiceResponse<List<Course>>();
//		KitesRequestUrl.dynamicUrl = ""+courseCategoryId;
		response.setOperatCode(KitesRequestUrl.getCourses(courseCategoryId));
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getCourses(courseCategoryId), requestStr ,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Course>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	/**
	 *  获取课程列表
	 *  
	 *  @param courseId
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId"})
	public ServiceResponse<List<Lesson>> getLessons(int courseId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Lesson>> response = new ServiceResponse<List<Lesson>>();
//		KitesRequestUrl.dynamicUrl = ""+courseId;
		response.setOperatCode(KitesRequestUrl.getLessons(courseId));
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getLessons(courseId), requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Lesson>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  获取用户自定义的课件列表
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<VideoDetail> getDefinedCourses() {
		// 默认初始化为失败信息
		ServiceResponse<VideoDetail> response = new ServiceResponse<VideoDetail>();
		response.setOperatCode(KitesRequestUrl.GET_DEFINED_COURSES);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_DEFINED_COURSES, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoDetail.class, response);
		}
		return response;
	}
	
	/**
	 *  获取用户自定义的课件中的课程
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId"})
	public ServiceResponse<VideoDetail> getDefinedLessons(int courseId) {
		// 默认初始化为失败信息
		ServiceResponse<VideoDetail> response = new ServiceResponse<VideoDetail>();
//		KitesRequestUrl.dynamicUrl = ""+ courseId;
		response.setOperatCode(KitesRequestUrl.GET_DEFINED_LESSONS);
        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_DEFINED_LESSONS, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoDetail.class, response);
		}
		return response;
	}
	
	/**
	 *  用户自定义课件
	 *  
	 *  @param name
	 *  @param videoSerialIds
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"name","videoSerialIds"})
	public ServiceResponse<String> doDefinedCourses(String name,int[] videoSerialIds) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_DEFINED_COURSES);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("name", name);
        jsonObj.addProperty("videoSerialIds", videoSerialIds.toString());
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_DEFINED_COURSES, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
 
	
	/**
	 *  添加用户自定义课件中的课程
	 *  
	 *  @param name
	 *  @param videoSerialIds
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId","videoSerialId"})
	public ServiceResponse<String> addDefinedCourseSerial(int courseId,int videoSerialId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = courseId+"/"+videoSerialId;
		response.setOperatCode(KitesRequestUrl.ADD_DEFINED_COURSE_SERIAL);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.ADD_DEFINED_COURSE_SERIAL, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	/**
	 *  取消用户自定义课件中的课程
	 *  
	 *  @param name
	 *  @param videoSerialIds
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId","videoSerialId"})
	public ServiceResponse<String> deleteDefinedCourseSerial(int courseId,int videoSerialId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = courseId+"/"+videoSerialId;
		response.setOperatCode(KitesRequestUrl.DELETE_DEFINED_COURSE_SERIAL);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_DEFINED_COURSE_SERIAL, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  取消用户自定义课件中的课程
	 *  
	 *  @param name
	 *  @param videoSerialIds
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"courseId"})
	public ServiceResponse<String> deleteDefinedCourse(int courseId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = ""+courseId;
		response.setOperatCode(KitesRequestUrl.DELETE_DEFINED_COURSE);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_DEFINED_COURSE, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}

	
	
    /**
	 *  获取视频分类
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<VideoCategory>> getVideoGategories() {
		// 默认初始化为失败信息
		ServiceResponse<List<VideoCategory>> response = new ServiceResponse<List<VideoCategory>>();
		response.setOperatCode(KitesRequestUrl.GET_VIDEOS_CATEGORIES);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_VIDEOS_CATEGORIES, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<VideoCategory>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
    /**
	 *  获取指定视频分类下的视频列表
	 *  
	 *  @param categoryValue
	 *  @param l
	 *  @param n
	 *  @param o
	 *  @param s
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"categoryValue","l","n","o","s"})
	public ServiceResponse<Page> getCategoryVideos(String categoryValue,int l,int n,String o,String s) {
		// 默认初始化为失败信息
		ServiceResponse<Page> response = new ServiceResponse<Page>();
		response.setOperatCode(KitesRequestUrl.getCategoryVideos(categoryValue));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getCategoryVideos(categoryValue), requestStr ,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, Page.class, response);
		}
		return response;
	}
	
	
    /**
	 *  获取视频详细数据
	 *  
	 *  @param videoId
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId"})
	public ServiceResponse<VideoDetail> getVideoDetails(int videoId) {
		// 默认初始化为失败信息
		ServiceResponse<VideoDetail> response = new ServiceResponse<VideoDetail>();
//		KitesRequestUrl.dynamicUrl = ""+videoId;
		response.setOperatCode(KitesRequestUrl.getVideoDetails(videoId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoDetails(videoId), requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoDetail.class, response);
		}
		return response;
	}
	
	
	
    /**
	 *  获取视频附加数据
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId"})
	public ServiceResponse<VideoAdditional> getVideoAdditional(int videoId) {
		// 默认初始化为失败信息
		ServiceResponse<VideoAdditional> response = new ServiceResponse<VideoAdditional>();
//		KitesRequestUrl.dynamicUrl = ""+videoId;
		response.setOperatCode(KitesRequestUrl.GET_VIDEO_ADDITIONAL);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_VIDEO_ADDITIONAL, requestStr ,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, VideoAdditional.class, response);
		}
		return response;
	}
	
    /**
	 *  获取视频片段数据
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"serialId"})
	public ServiceResponse<List<Segment>> getVideoSegment(int serialId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Segment>> response = new ServiceResponse<List<Segment>>();
//		KitesRequestUrl.dynamicUrl = "" + serialId;
		response.setOperatCode(KitesRequestUrl.getVideoSegment(serialId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoSegment(serialId), requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Segment>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	/**
	 *  获取视频片段详细数据
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"segmentId"})
	public ServiceResponse<Segment> getVideoSegmentDetails(int segmentId) {
		// 默认初始化为失败信息
		ServiceResponse<Segment> response = new ServiceResponse<Segment>();
//		KitesRequestUrl.dynamicUrl = "" + segmentId;
		response.setOperatCode(KitesRequestUrl.getVideoSegmentDetails(segmentId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoSegmentDetails(segmentId), requestStr ,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果

			JsonHandler.jsonToObject(responseStr, Segment.class, response);
			
		}
		return response;
	}
	
	/**
	 *  获取视频片段词汇
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"segmentId"})
	public ServiceResponse<List<Word>> getVideoSegmentWords(int segmentId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Word>> response = new ServiceResponse<List<Word>>();
//		KitesRequestUrl.dynamicUrl = "" + segmentId;
		response.setOperatCode(KitesRequestUrl.getVideoSegmentWords(segmentId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoSegmentWords(segmentId), requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Word>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  获取视频句子数据
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"segmentId"})
	public ServiceResponse<List<Sentences>> getVideoSegmentSentences(int segmentId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Sentences>> response = new ServiceResponse<List<Sentences>>();
//		KitesRequestUrl.dynamicUrl = "" + segmentId;
		response.setOperatCode(KitesRequestUrl.getVideoSegmentSentences(segmentId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoSegmentSentences(segmentId), requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Sentences>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	/**
	 *  获取视频片段测验数据
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"segmentId"})
	public ServiceResponse<List<Test>> getVideoSegmentExams(int segmentId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Test>> response = new ServiceResponse<List<Test>>();
//		KitesRequestUrl.dynamicUrl = "" + segmentId;
		response.setOperatCode(KitesRequestUrl.getVideoSegmentExams(segmentId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoSegmentExams(segmentId), requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Test>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	/**
	 *  获取视频评论数据
	 *  
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId"})
	public ServiceResponse<List<Comment>> getVideoComments(int videoId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Comment>> response = new ServiceResponse<List<Comment>>();
//		KitesRequestUrl.dynamicUrl = "" + videoId;
		response.setOperatCode(KitesRequestUrl.getVideoComments(videoId));

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.getVideoComments(videoId), requestStr,RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Comment>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  添加视频评论数据
	 *  
	 *  @param videoId
	 *  @param comment
	 *  @param rating
	 *  @param verifyType
	 *  @param challenge
	 *  
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"videoId","comment","rating","verifyType","challenge"})
	public ServiceResponse<Comment> addVideoComment(int videoId,String comment, int rating, String verifyType, String challenge) {
		// 默认初始化为失败信息
		ServiceResponse<Comment> response = new ServiceResponse<Comment>();
		response.setOperatCode(KitesRequestUrl.ADD_VIDEO_COMMENT);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("videoId", videoId);
        jsonObj.addProperty("comment", comment);
        jsonObj.addProperty("rating", rating);
        jsonObj.addProperty("verifyType", verifyType);
        jsonObj.addProperty("challenge", challenge);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.doHttpRequestJson(KitesRequestUrl.ADD_VIDEO_COMMENT, requestStr ,false,false,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, Comment.class, response);
		}
		return response;
	}
	
	/**
	 *  删除视频评论数据
	 *  
	 *  @param code
	 *  @param value
	 *
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"commentId"})
	public ServiceResponse<String> deleteVideoComment(int commentId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DELETE_VIDEO_COMMENT);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_VIDEO_COMMENT, requestStr);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  最新的RSS
	 *  
	 *  @param categorySize
	 *  @param itemSize
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"categorySize","itemSize"})
	public ServiceResponse<List<Rss>> getNewestRss(int categorySize,int itemSize) {
		// 默认初始化为失败信息
		ServiceResponse<List<Rss>> response = new ServiceResponse<List<Rss>>();
		response.setOperatCode(KitesRequestUrl.GET_NEWEST_RSS);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("categorySize", categorySize);
        jsonObj.addProperty("itemSize", itemSize);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_NEWEST_RSS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Rss>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  获取RSS分类
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<Rss>> getCategoriesRss() {
		// 默认初始化为失败信息
		ServiceResponse<List<Rss>> response = new ServiceResponse<List<Rss>>();
		response.setOperatCode(KitesRequestUrl.GET_CATEGORIES_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_CATEGORIES_RSS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Rss>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  获取指定RSS分类下的文章列表
	 *  
	 *  @param rssCategoryId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"rssCategoryId"})
	public ServiceResponse<List<Items>> getCategoriesItemRss(int rssCategoryId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Items>> response = new ServiceResponse<List<Items>>();
//		KitesRequestUrl.dynamicUrl = "" + rssCategoryId;
		response.setOperatCode(KitesRequestUrl.GET_CATEGORY_ITEM_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_CATEGORY_ITEM_RSS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Items>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  用户订阅的RSS
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<Rss>> getUserRss() {
		// 默认初始化为失败信息
		ServiceResponse<List<Rss>> response = new ServiceResponse<List<Rss>>();
		response.setOperatCode(KitesRequestUrl.GET_USER_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_USER_RSS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Rss>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  订阅RSS
	 *  
	 *  @param rssCategoryId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"rssCategoryId"})
	public ServiceResponse<String> doSubscribeRss(int rssCategoryId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = "" + rssCategoryId;
		response.setOperatCode(KitesRequestUrl.DO_SUBSCRIBE_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_SUBSCRIBE_RSS, requestStr, RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  取消RSS订阅
	 *  
	 *  @param rssCategoryId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"rssCategoryId"})
	public ServiceResponse<String> deleteUserRss(int rssCategoryId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
//		KitesRequestUrl.dynamicUrl = "" + rssCategoryId;
		response.setOperatCode(KitesRequestUrl.DELETE_USER_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_USER_RSS, requestStr, RequestMethod.METHOD_DELETE);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  用户收藏的RSS文章列表
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<List<Items>> getFavoritesRss() {
		// 默认初始化为失败信息
		ServiceResponse<List<Items>> response = new ServiceResponse<List<Items>>();
		response.setOperatCode(KitesRequestUrl.GET_FAVORITES_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_FAVORITES_RSS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Items>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  收藏RSS文章
	 *  
	 *  @param itemId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"itemId"})
	public ServiceResponse<String> doFavoritesItemRss(int itemId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_FAVORITES_ITEM_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_FAVORITES_ITEM_RSS, requestStr, RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  取消RSS的文章收藏
	 *  
	 *  @param itemId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"itemId"})
	public ServiceResponse<String> deleteFavoritesItemRss(int itemId) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DELETE_FAVORITES_ITEM_RSS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DELETE_FAVORITES_ITEM_RSS, requestStr, RequestMethod.METHOD_DELETE);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  获取单词的详细信息
	 *  
	 *  @param word
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"word"})
	public ServiceResponse<List<Word>> getWordDetails(String word) {
		// 默认初始化为失败信息
		ServiceResponse<List<Word>> response = new ServiceResponse<List<Word>>();
//		KitesRequestUrl.dynamicUrl = word;
		response.setOperatCode(KitesRequestUrl.GET_WORD_DETAILS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_WORD_DETAILS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Word>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  获取单词的例句
	 *  
	 *  @param wordId
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"wordId"})
	public ServiceResponse<List<Sentences>> getWordSentences(int wordId) {
		// 默认初始化为失败信息
		ServiceResponse<List<Sentences>> response = new ServiceResponse<List<Sentences>>();
//		KitesRequestUrl.dynamicUrl = ""+wordId;
		response.setOperatCode(KitesRequestUrl.GET_WORD_SENTENCES);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_WORD_SENTENCES, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Sentences>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
	/**
	 *  获取相似单词
	 *  
	 *  @param word
	 *  @param limit
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"word","limit"})
	public ServiceResponse<List<Sentences>> getSimilarWords(String word,int limit) {
		// 默认初始化为失败信息
		ServiceResponse<List<Sentences>> response = new ServiceResponse<List<Sentences>>();
//		KitesRequestUrl.dynamicUrl = word + "similar" + limit;
		response.setOperatCode(KitesRequestUrl.GET_SIMILAR_WORDS);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_SIMILAR_WORDS, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			Type type = new TypeToken<List<Sentences>>() {
			}.getType();
			JsonHandler.jsonToList(responseStr, type, response);
		}
		return response;
	}
	
	
    /**
	 *  用户反馈
	 *  
	 *  @param content
	 *  @param verifyType
	 *  @param challenge
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"content","verifyType","challenge"})
	public ServiceResponse<String> doFeedback(String content,String verifyType, String challenge) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_FEEDBACK);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("content", content);
        jsonObj.addProperty("verifyType", verifyType);
        jsonObj.addProperty("challenge", challenge);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.doHttpRequestJson(KitesRequestUrl.DO_FEEDBACK, requestStr,false,false,RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		return response;
	}
	
	
	/**
	 *  获取图片验证码
	 *  
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {})
	public ServiceResponse<String> getCaptcha() {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.GET_CAPTCHA);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.GET_CAPTCHA, requestStr, RequestMethod.METHOD_GET);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
			response.setResponse(responseStr);
		}
		return response;
	}
	
	
	/**
	 *  验证图片验证码
	 *  
	 *  @param verifyType
	 *  @param challenge
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"verifyType","challenge"})
	public ServiceResponse<String> doVerifyCaptcha(String verifyType, String challenge) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(KitesRequestUrl.DO_VERIFY_CAPTCHA);

        JsonObject jsonObj = new JsonObject();
        jsonObj.addProperty("verifyType", verifyType);
        jsonObj.addProperty("challenge", challenge);
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
		NetworkResponse netResponse = NetworkAccess.httpRequest(KitesRequestUrl.DO_VERIFY_CAPTCHA, requestStr, RequestMethod.METHOD_POST);
		
		// HTTP结果返回
		// 1.错误码转义
		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
			// 返回成功 解析结果
			JsonHandler.jsonToObject(responseStr, String.class, response);
		}
		return response;
	}
	
	
	/**
	 *  播放视频流文件
	 *  
	 *  @param url
	 *  @param name
	 *
	 *  @return
	 */
	@Field_Method_Parameter_Annotation(args = {"url","name"})
	public ServiceResponse<String> getVideoStream(String url,String name) {
		// 默认初始化为失败信息
		ServiceResponse<String> response = new ServiceResponse<String>();
		response.setOperatCode(url);

        JsonObject jsonObj = new JsonObject();
        String requestStr = jsonObj.toString();
        
		// 参数转换为Json
        File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "learningkitesCache"
        		+ name+".mp4" );
        if (!file.exists()) {
        	NetworkResponse netResponse = NetworkAccess.httpRequestVideo(url,name);
        	if (netResponse.getStatusCode() == ServiceMediator.Service_Return_Success) {
    			// 返回成功 解析结果
    			response.setResponse(netResponse.getData());
    			response.setReturnCode(netResponse.getStatusCode());
    		}
		}else {
			response.setResponse(file.getAbsolutePath());
			response.setReturnCode(ServiceMediator.Service_Return_Success);
		}
		
		
		// HTTP结果返回
		// 1.错误码转义
//		String responseStr = ServiceUtils.getRequestResult(response, netResponse);
//		if (response.getReturnCode() == ServiceMediator.Service_Return_Success) {
//			// 返回成功 解析结果
//			JsonHandler.jsonToObject(responseStr, String.class, response);
//		}
		
		return response;
	}
	
	
}
